<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>
    var arr = [3,6,4,2,11,10,5];

    for (var j = 0; j < arr.length-1; j++) {
        for (var i = 0; i < arr.length - 1 - j; i++) {
            if (arr[i] > arr[i + 1]) {
                var temp = arr[i];//temp = 3
                arr[i] = arr[i + 1];//arr[i] = 6
                arr[i + 1] = temp;//arr[i+1] = 3

            }
        }
    }
    console.log(arr);



    var num = [20,30,45,22,17,6,7];
    for(j=0; j<num.length - 1; j++){
        for(i=0; i<num.length -1 -j; i++){
            if(num[i]>num[i+1]){
                var jk =num[i];
                num[i] = num[i+1]
                num[i+1] = jk;
            }
        }
    }
console.log(num);
</script>

</body>
</html>